package com.demo.rule.servlet;

import com.demo.tomcat.MyRequest;
import com.demo.tomcat.MyResponse;

import java.io.IOException;

public abstract class MyServlet {


    public void service(MyRequest request, MyResponse response) throws Exception{
        if ("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        }else {
            doPost(request, response);
        }
    }


    protected abstract void doGet(MyRequest request, MyResponse response) throws IOException;


    protected abstract void doPost(MyRequest request, MyResponse response) throws IOException;
}
